package cn.icanci.ladybird.service.impl;

import cn.icanci.ladybird.pojo.entity.UserInfoOrderInfoMiddle;
import cn.icanci.ladybird.dao.UserInfoOrderInfoMiddleDao;
import cn.icanci.ladybird.service.UserInfoOrderInfoMiddleService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (UserInfoOrderInfoMiddle)表服务实现类
 *
 * @author makejava
 * @since 2020-09-29 20:45:26
 */
@Service("userInfoOrderInfoMiddleService")
public class UserInfoOrderInfoMiddleServiceImpl implements UserInfoOrderInfoMiddleService {
    @Resource
    private UserInfoOrderInfoMiddleDao userInfoOrderInfoMiddleDao;

    /**
     * 通过ID查询单条数据
     *
     * @param userInfoOrderInfoMiddleId 主键
     * @return 实例对象
     */
    @Override
    public UserInfoOrderInfoMiddle queryById(Long userInfoOrderInfoMiddleId) {
        return this.userInfoOrderInfoMiddleDao.queryById(userInfoOrderInfoMiddleId);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<UserInfoOrderInfoMiddle> queryAllByLimit(int offset, int limit) {
        return this.userInfoOrderInfoMiddleDao.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param userInfoOrderInfoMiddle 实例对象
     * @return 实例对象
     */
    @Override
    public UserInfoOrderInfoMiddle insert(UserInfoOrderInfoMiddle userInfoOrderInfoMiddle) {
        this.userInfoOrderInfoMiddleDao.insert(userInfoOrderInfoMiddle);
        return userInfoOrderInfoMiddle;
    }

    /**
     * 修改数据
     *
     * @param userInfoOrderInfoMiddle 实例对象
     * @return 实例对象
     */
    @Override
    public UserInfoOrderInfoMiddle update(UserInfoOrderInfoMiddle userInfoOrderInfoMiddle) {
        this.userInfoOrderInfoMiddleDao.update(userInfoOrderInfoMiddle);
        return this.queryById(userInfoOrderInfoMiddle.getUserInfoOrderInfoMiddleId());
    }

    /**
     * 通过主键删除数据
     *
     * @param userInfoOrderInfoMiddleId 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Long userInfoOrderInfoMiddleId) {
        return this.userInfoOrderInfoMiddleDao.deleteById(userInfoOrderInfoMiddleId) > 0;
    }

    @Override
    public List<UserInfoOrderInfoMiddle> queryByOrderId(Long orderInfoId) {
        return this.userInfoOrderInfoMiddleDao.queryByOrderId(orderInfoId);
    }

    @Override
    public List<UserInfoOrderInfoMiddle> queryByUserInfoId(Long userInfoId) {
        return this.userInfoOrderInfoMiddleDao.queryByUserInfoId(userInfoId);
    }


}